// pages/posterShare/posterShare.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    codeImg: null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    wx.showLoading({
      title: '加载中',
    });
    let info = JSON.parse(options.info);
    info.title = info.title.substring(0, 10);
    info.avatar_url = "https://rybc.0791jr.com/data/attachment/avatar/" + info.avatar_url;
    this.setData({
      info: info
    });
    wx.request({
      url: app.baseURL + 'Bargain&a=get_qrcode',
      data: {
        bar_id: info.bar_id,
        user_id: app.globalData.userId,
        path: '/pages/bargainDetails/bargainDetails?bar_id=' + info.bar_id + '&act_id=' + info.id,
        width: 50
      },
      success: res => {
        this.setData({
          codeImg:  res.data.qrcode,
          nickname: wx.getStorageSync('userInfo').nickName,
        });
        wx.hideLoading();
      }
    })
  }
})